﻿using System;
using System.Collections.Generic;
using System.Text;
using Barbar.MapReport.Common;
using System.Collections.ObjectModel;
using System.Globalization;
using System.Web;
using Barbar.MapReport.Common.Drawing.ValueIndicators;
using Microsoft.Practices.EnterpriseLibrary.Validation.Validators;
using Barbar.MapReport.Common.Resources;
using System.Xml.Serialization;

namespace Barbar.MapReport.Common.Drawing.Commands {
  [XmlType(Namespace = Constants.XmlNamespace)]
  [Serializable]
  public class AddDynamicValueIndicatorsCommand : DrawingCommand, IDataLocationProvider {
    private int m_Radius;
    private Collection<BusinessGeoPoint> m_Points;
    private BaseProperties m_Properties;
    private DataLocation m_DataLocation = new DataLocationInline();

    [RangeValidator(1, RangeBoundaryType.Inclusive, 1000, RangeBoundaryType.Inclusive, MessageTemplateResourceName="Validation_SetSearchVisibilityCommand_Radius", MessageTemplateResourceType=typeof(Translator))]
    public int Radius {
      get { return m_Radius; }
      set { m_Radius = value; }
    }

    [NotNullValidator(MessageTemplateResourceName = "Validation_Common_NotNullProperty", MessageTemplateResourceType = typeof(Translator))]
    public Collection<BusinessGeoPoint> Points {
      get { return m_Points; }
      set { m_Points = value; }
    }

    [NotNullValidator(MessageTemplateResourceName = "Validation_Common_NotNullProperty", MessageTemplateResourceType = typeof(Translator))]
    public BaseProperties Properties {
      get { return m_Properties; }
      set { m_Properties = value; }
    }

    public override void Render(IRenderer renderer) {
      renderer.AddDynamicValueIndicators(this);
    }

    #region IDataLocationProvider Members

    public DataLocation DataLocation {
      get { return m_DataLocation; }
      set { m_DataLocation = value; }
    }

    #endregion
  }
}
